package com.hospital.controller;

import com.hospital.pojo.Doctor;

import com.hospital.service.DoctorService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin
public class DoctorController {
    @Autowired
    private DoctorService doctorService;

    @GetMapping ("/login")
    public List<Doctor> findAjaxUser() {
        return doctorService.findAll();
    }
    @PutMapping("/login/update")
    public void updateUser(@RequestBody Doctor doctor){
        doctorService.updateUser(doctor);
    }
    @DeleteMapping("/axiosUser/deleteUser")
    public void deleteUser(Integer id){
        doctorService.deleteUserById(id);
    }
}